﻿using System;
using System.Collections.Generic;
using System.Text;

namespace daSyntaxAnalyser.SyntaxTree
{
    using daBase.Objects;

    public class ArrayConstTypeElement : SyntaxTreeElement, IConstTypeElement
    {
        private IntervalsVariableExpressionElement intervals;
        private IConstTypeElement type;

        public IntervalsVariableExpressionElement Intervals { get { return intervals; } set { intervals = value; } }
        public IConstTypeElement Type { get { return type; } set { type = value; } }

        public ArrayConstTypeElement(TokenInfo StartInfo, IntervalsVariableExpressionElement Intervals, IConstTypeElement Type, List<TokenInfo> Comments)
            : base(StartInfo, Comments)
        {
            intervals = Intervals;
            type = Type;
        }

        public override string ToString()
        {
            return string.Format("array {0} of {1}", intervals, type);
        }

        protected override IEnumerator<ISyntaxTreeElement> CreateEnumerator()
        {
            yield return intervals;
            yield return type;
        }
    }
}
